<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
//找出 Marquee  Site
$arrSite = $_arrMarqueeSite;//array();
/*$strSQL = "select ID, Sites_".$_intLang." as Sites from `bet_MarqueeSite` order by ID";
if(!$RS = PMA_mysql_query($strSQL, $$_Conn)){
	$GLOBALS["errormessage"] = "Find Marquee Data Error!!";
	$GLOBALS["errorhidden"] = "\n<!-- Error: ".PMA_mysql_error($$_Conn).",\nLine: ".__LINE__.",\nPage: ".__FILE__." //-->";
	ErrMsgOutputHTML("Error", "", 1);
}
while($Rows = PMA_mysql_fetch_object($RS)){
	$arrSite[$Rows -> ID] = $Rows -> Sites;
}*/

$fp = @file($strTemplatePath."Add.html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);

if(!$isShowIsHidden)$fp = preg_replace("/<!-- BOF@isHidden \/\/-->.+<!-- EOF@isHidden \/\/-->/s", $strCon, $fp);

$intKey = 0;
$strCon = "";
$strTmp = "";
preg_match("/<!-- @ Site Start @ \/\/-->(.+)<!-- @ Site End @ \/\/-->/s", $fp, $arrCon);

foreach($arrSite as $intSID => $strSite){
	$strTmp = $arrCon[1];
	$strTmpSpgTag = getSpGroupTag($intSID, "");

	$strTmp = str_replace("{ShowKey}", $intKey, $strTmp);
	$strTmp = str_replace("{ShowSiteID}", $intSID, $strTmp);
	$strTmp = str_replace("{ShowSiteName}", $strSite." ".$strTmpSpgTag, $strTmp);
	$strCon .= $strTmp."\n";
	$intKey++;
}
$fp = preg_replace("/<!-- @ Site Start @ \/\/-->.+<!-- @ Site End @ \/\/-->/s", $strCon, $fp);

while(list($k, $v) = each($_strMarquee)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

$a = getdate();
$OnDate = date("Y-m-d", mktime(0, 0, 0, $a["mon"], $a["mday"] - 1, $a["year"]));
$OffDate = date("Y-m-d", mktime(0, 0, 0, $a["mon"], $a["mday"] + 2, $a["year"]));
$fp = str_replace("{ShowOnDate}", $OnDate, $fp);
$fp = str_replace("{ShowOffDate}", $OffDate, $fp);

//輸出
WebOutputHTML($fp, 1);
?>